package org.zachary.agent.infrastructure.repository;

import org.springframework.stereotype.Repository;
import org.zachary.agent.domain.aggregate_model.check_ucs_info.CheckInfo;
import org.zachary.agent.domain.repository.CheckUcsInfoRepository;

@Repository
public class JpaCheckerUcsRepository implements CheckUcsInfoRepository {
    private final SpringDataCheckUcsRepository jpaRepo;

    public JpaCheckerUcsRepository(SpringDataCheckUcsRepository jpaRepo) {
        this.jpaRepo = jpaRepo;
    }

    @Override
    public void setChecker(Integer checkerId, Integer userId) {
        CheckInfo info = new CheckInfo(
                null,
                checkerId,
                userId
        );
        jpaRepo.save(info);
    }

    @Override
    public void save(Integer id) {
        CheckInfo info = new CheckInfo(
                null,
                null,
                id
        );
        jpaRepo.save(info);
    }
}